X * dial.vt100 - An ARexx script for use with VT100 (V2.9 or higher)
X *
X * This program allows the user to save up to 20 frequently used
X * phone numbers. The program will dial the phone number, at the
X * request of the user. Each number has 7 fields associated with it.
X * They are:
X *
X * Name: An ascii string describing the number.
X * Phone: The actual phone number to be dialed
X * Baud: The Baud Rate that VT100 should be set to when dialing this number
X * Parity: The Parity that VT100 should be set to when dialing this number
X * Prefix: A string that is sent to the modem BEFORE dialing the number
X * Postfix: A string that is sent to the modem AFTER dialing the number,
X * A carrige return is signified by "^M".
X * Script: The name of an ARexx script to be called. This script is passed
X * the above mentioned parameters. When a user's script is called,
X * this script exit's. All dialing must be done by the user's script.
X * This script launches the user's script via VT100's RX command.
X * Therfore, the user's script must end in '.vt100'.
X *
X * The phone file defaults to S:VT100.phones. If it doesn't exist, dial
X * will use default values for all fields.
X *
X * To install: just copy this file to REXX:dial.vt100
X *
X * To run: either directly execute from the VT100 "REXX MACRO" menu, or
X * issue the "RX DIAL" script command.
X *
X *
X * This program requires:
X * VT100 Version 2.9 (Released October-89)
X * ARexx
X * arp.library (PD routines)
X * rexarplib.library (PD routines, necessary for windowing)
X *
X * VT100, arp.library, and rexarplib.library are avaliable in many
X * PD collections.
X *
X * ARexx is a licensed program, written by William S. Hawes
X *
X ****************************************************************************
X * dial.vt100 - Copyright 1989 by Starbound Computing, a division of
X * Starbound Enterprizes.
X *
X * - Written by David W. Lowrey (USENET: amdahl!dwl10)
X *
X * THIS PROGRAM IS NOT IN THE PUBLIC DOMAIN!!!
X *
X * All Rights Reserved. This program may be freely used and copied, as long
X * as no fee, other than a "reasonable" copying charge, is charged for
X * it's use.
X *
X * Permission is granted to include this program in various user group PD
X * collections, the FISH PD collection, or private PD collections.
X *
X * Inclusion in and commercial PD disk collections, including Magazine
X * disks, requires written permission from the author.
X *
X * Any use for comercial purposes requires written permission
X * from the author.
X *
X */
X
X/*
X * Version 1.2: Striped off extra blanks from dial strings before sending
X * them to VT100 (the modem).
X *
X * Version 1.1: Cleaned up code.
X *
X * Version 1.0: Initial public release
X */
X
X/*
X * default values
X *
X * feel free to change any of these
X * Note that the default name must be exactly 25 characters long
X */
Xdefault.name = " "
Xdefault.phone = " "
Xdefault.baud = "2400"
Xdefault.parity = "NONE"
Xdefault.prefix = "ATDT"
Xdefault.postfix = "^M" /* carrage return after dial string */
Xdefault.script = " "
X
X/*
X * Make sure the required libraries have been loaded
X */
Xif ~show('l', "rexxarplib.library") then do
X check = addlib('rexxarplib.library',0,-30,0)
X if ~check then do
X say "Can't load rexxarplib.library!"
X exit -1
X end
X else nop
Xend
Xelse nop
X
Xif ~show('l', "rexxsupport.library") then do
X check = addlib('rexxsupport.library',0,-30,0)
X if ~check then do
X say "Can't load rexxsupport.library!"
X exit -1
X end
X else nop
Xend
Xelse nop
X
X/*
X * Create the window manager process
X */
Xaddress command run "rx 'call CreateHost(DIALWIN,DIALPORT)'"
Xaddress command "waitforport DIALWIN" /* wait for port to come active */
X
X/*
X * Window sizes
X */
Xwindow.leftedge = 50
Xwindow.topedge = 0
Xwindow.width = 470
Xwindow.height = 200
X
X/*
X * Initialize data values
X */
Xnames. = default.name
Xphones. = default.phone
Xbaud. = default.baud
Xparity. = default.parity
Xprefix. = default.prefix
Xpostfix. = default.postfix
Xscript. = default.script
X
Xsavefile = "S:VT100.phones"
X
Xmod.=""
X
Xgadget.previous=0
Xmodified=0
X
Xcall OpenWin1
X
X/* Open our host port */
Xcall openport(DIALPORT)
X
X/*
X * read in the phone directory
X */
Xcall ReadPhone
X
Xcall DrawScreen1
X
X/*
X * Wait for messages at DIALPORT
X */
Xquitflag = 0
Xdo forever until quitflag
X call waitpkt(DIALPORT)
X p = getpkt(DIALPORT)
X if p ~== '0000 0000'x then
X do
X
X thisarg = getarg(p)
X gadgetnum = getarg(p,1)
X t=reply(p, 0)
X
X/*
X * Decode the IDCMP message
X */
X
X select
X /*
X * Messages are either CLOSEWINDOW
X */
X when thisarg == 'CLOSEWINDOW' then do
X if modified=1 then reply=Request(140, 40,"NOTICE: There are unsaved\changes. Click 'Cancel' to abort.\Click 'Okay' to continue, and\loose all changes.",,"Okay","Cancel")
X else reply="OKAY"
X if reply == "OKAY" then do
X call CloseWindow(DIALWIN)
X quitflag = 1
X end
X else nop
X end
X /*
X * ...or one of the Phone Number gadgets has been selected
X */
X when thisarg == 'Gadget' then do
X gadget.current = gadgetnum
X
X if gadget.current == gadget.previous then do
X call SetGadget(DIALWIN, gadget.current, "OFF")
X gadget.previous=0
X gadget.current=0
X end
X else do
X call SetGadget(DIALWIN, gadget.current, "ON")
X if gadget.previous ~== 0 then call SetGadget(DIALWIN, gadget.previous, OFF)
X gadget.previous=gadget.current
X end
X
X end
X /*
X * ...or the LOAD Gadget has been selected
X */
X
X when thisarg == 'Load' then do
X if modified=1 then reply=Request(140, 40,"NOTICE: There are unsaved\changes. Click 'Cancel' to abort.\Click 'Okay' to continue, and\loose all changes.",,"Okay","Cancel")
X else reply="OKAY"
X if reply == "OKAY" then do
X newsave=Request(140,40," LOAD PHONE FILE\\Enter name of phone file",savefile,"Okay","Cancel")
X if newsave ~= "" then do
X if exists(newsave) then do
X savefile=newsave
X call ReadPhone
X call CloseWindow(DIALWIN,"CONTINUE")
X call OpenWin1
X call DrawScreen1
X modified=0
X end
X else do
X t=Request(140,40,"Phone file not found\Load request canceled",,"Okay",)
X end
X end
X else nop
X end
X else nop
X end
X
X /*
X * ...or the SAVE gadget has been selected
X */
X
X when thisarg == 'Save' then do
X newsave=Request(140,40," SAVE PHONE FILE\\Enter name of phone file",savefile,"Okay","Cancel")
X if newsave ~= "" then do
X savefile=newsave
X call SavePhone
X modified=0
X end
X else nop
X end
X /*
X * ...or the DELETE gadget has been selected
X */
X
X when thisarg == 'Delete' then do
X if gadget.current ~= 0 then do
X index=gadget.current
X t=Request(140,40," DELETE ENTRY\\"names.index"\\is about to be deleted\Please confirm:",,"Okay","Cancel")
X if t == "OKAY" then do
X names.index=" "
X phones.index=" "
X baud.index="2400"
X parity.index="NONE"
X prefix.index=" "
X postfix.index=" "
X script.index=" "
X call CloseWindow(DIALWIN,"CONTINUE")
X call OpenWin1
X call DrawScreen1
X gadget.current=0
X gadget.previous=0
X modified=1
X end
X else nop
X end
X else nop
X end
X
X /*
X * ...or MODIFY has been selected
X */
X
X when thisarg == 'Modify' then do
X if gadget.current ~= 0 then do
X result=modify(gadget.current)
X if result == 'Okay' then do
X i = gadget.current
X names.i = mod.names
X phones.i = mod.phones
X baud.i = mod.baud
X parity.i = mod.parity
X prefix.i = mod.prefix
X postfix.i = mod.postfix
X script.i = mod.script
X modified = 1
X end
X else nop
X
X call CloseWindow(DIALWIN,"CONTINUE")
X call OpenWin1
X call DrawScreen1
X call SetGadget(DIALWIN,gadget.current, "ON")
X end
X else nop
X end
X
X /*
X * ...or the Dial gadget
X */
X when thisarg == 'Dial' then do
X if gadget.current ~= 0 then do
X if modified=1 then reply=Request(140, 40,"NOTICE: There are unsaved\changes. Click 'Cancel' to abort.\Click 'Okay' to continue, and\loose all changes.",,"Okay","Cancel")
X else reply="OKAY"
X if reply == "OKAY" then do
X i=gadget.current
X if strip(script.i) = "" then do
X dial.prefix=strip(prefix.i)
X dial.phones=strip(phones.i)
X dial.postfix=strip(postfix.i)
X 'BAUD 'baud.i
X 'PARITY 'parity.i
X 'SEND "'dial.prefix||dial.phones||dial.postfix'"'
X end
X else do
X /*
X * Launch user's script as a seperate task
X * we will end this script now.
X */
X 'rx 'script.i names.i" "phones.i" "baud.i" "parity.i" "prefix.i" "postfix.i
Xcall Text(DIALWIN, "You must press "RETURN" to save each field")
X
Xcall ActivateGadget(DIALWIN, 1)
X
X/*
X * Wait for messages at DIALPORT
X */
Xquitflag = 0
Xgadnum.names = 1
Xgadnum.phones = 2
Xgadnum.baud = 3
Xgadnum.parity = 4
Xgadnum.prefix = 5
Xgadnum.postfix = 6
Xgadnum.script = 7
X
Xdo forever until quitflag
X call waitpkt(DIALPORT)
X p = getpkt(DIALPORT)
X if p ~== '0000 0000'x then
X do
X
X thisarg = getarg(p)
X string = getarg(p,1)
X t=reply(p, 0)
X
X/*
X * Decode the IDCMP message
X */
X
X select
X /*
X * Messages are either CLOSEWINDOW ...
X */
X when thisarg == 'CLOSEWINDOW' then do
X if modified = 1 then reply=Request(140, 40,"NOTICE: There are unsaved\changes. Click 'Cancel' to abort.\Click 'Okay' to continue, and\loose all changes.",,"Okay","Cancel")
X else reply="OKAY"
X if reply == "OKAY" then do
X ret="Not Modified"
X quitflag = 1
X end
X else nop
X end
X
X /*
X * ...or "Quit" (exit with new values)
X */
X when thisarg == 'Okay' then do
X if modified == 1 then do
X call formatmod
X mod.names=center(strip(mod.names),25)
X ret = 'Okay'
X end
X else ret = 'Not Modified'
X quitflag = 1
X end
X
X /*
X * ...or one of the free formstring gadgets has been selected
X */
X when thisarg=='names' | thisarg=='phones' | thisarg=='prefix' ,
X | thisarg=='postfix' | thisarg=='script' then do
X upperarg=upper(thisarg)
X if mod.upperarg ~= string then do
X mod.upperarg = string
X modified = 1
X end
X else nop
X nextgad = gadnum.upperarg + 1
X if nextgad == 8 then nextgad = 1
X else nop
X call ActivateGadget(DIALWIN, nextgad)
X end
X
X /*
X * ...or baud has been selected
X */
X when thisarg == 'baud' then do
X if string=300 | string=1200 | string=2400 | string=4800 | string=9600 then do
X mod.baud = string
X modified = 1
X call ActivateGadget(DIALWIN, gadnum.baud+1)
X end
X else do
X r=Request(140, 40, "Invalid Baud rate. Baud rate must be\one of the following:\300, 1200, 2400, 4800, 9600",,"Okay")
X call ActivateGadget(DIALWIN, gadnum.baud)
X end
X end
X /*
X * ...or Parity has been selected
X */
X when thisarg == 'parity' then do
X string = upper(string)
X if string='NONE' | string='MARK' | string='SPACE' | string='EVEN' | string='ODD' then do
X mod.parity = string
X modified = 1
X call ActivateGadget(DIALWIN, gadnum.parity+1)
X end
X else do
X r=Request(140, 40, "Invalid Parity. Parity must be\one of the following:\NONE, MARK, SPACE, EVEN, ODD",,"Okay")
X call ActivateGadget(DIALWIN, gadnum.parity)
X end
X end
X
X otherwise do
X say thisarg
X end
X end
X end
X else nop
Xend
Xreturn ret
X
X/*
X * Format fields
X */
X
Xformatmod: procedure expose mod.
Xmod.names = left(strip(mod.names), 25)
Xmod.phones = left(strip(mod.phones), 25)
Xmod.baud = left(strip(mod.baud), 4)
Xmod.parity = left(strip(mod.parity), 5)
Xmod.prefix = left(strip(mod.prefix), 25)
Xmod.postfix = left(strip(mod.postfix), 25)
Xmod.script = left(strip(mod.script), 25)
Xreturn
END_OF_FILE
if test 17156 -ne `wc -c <'dial.vt100'`; then
echo shar: \"'dial.vt100'\" unpacked with wrong size!
fi
# end of 'dial.vt100'
fi
echo shar: End of archive 1 \(of 1\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have the archive.
rm -f ark[1-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0
--
Submissions to comp.sources.amiga and comp.binaries.amiga should be sent to:
amiga@cs.odu.edu
or amiga@xanth.cs.odu.edu ( obsolescent mailers may need this address )
or ...!uunet!xanth!amiga ( very obsolescent mailers need this address )
Comments, questions, and suggestions s should be addressed to ``amiga-request''
(only use ``amiga'' for submissions) at the above addresses.